//
//  MineTableListHeaderView.swift
//  MT
//
//  Created by M on 2019/12/26.
//  Copyright © 2019 张强. All rights reserved.
//

import UIKit
import MTCategory

class MineTableListHeaderView: UIView {

    /// button
    lazy var postButton: UIButton = {
        let btn = UIButton()
        btn.setImage(UIImage(named: "icon_post"), for: .normal)
        btn.addTarget(self, action: #selector(listHeaderView(didClickPostButton:)), for: .touchUpInside)
        return btn
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        initializeUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

// MARK: ------------------ 初始化 ----------------------
extension MineTableListHeaderView {
    
    private func initializeUI() {
        addSubview(postButton)
        postButton.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(16)
            make.bottom.equalTo(self)
            make.width.height.equalTo(44)
        }
    }
    
}

// MARK: ------------------ 事件方法 ----------------------
@objc
extension MineTableListHeaderView {
    
    private func listHeaderView(didClickPostButton sender: UIButton) {
        NotificationCenter.default.post(name: GlobalNotificationName.presentPostController.name, object: nil)
    }
    
}
